From 7d2c65d2e32650375095511ddf6a09f2cc2b9918 Mon Sep 17 00:00:00 2001 From: "cl349@arcadians.cl.cam.ac.uk" Date: Thu, 25 Nov 2004 17:45:30 +0000 Subject: [PATCH] bitkeeper revision 1.1159.194.5 (41a61a3a3tGHnMob5s6YpzKC0ZK3aA) memory.c: Fix case where we have a conflicting current active p.t. Also simplify code flow. --- xen/arch/x86/memory.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c index c6d9951bc5..ba6efa0de4 100644 --- a/xen/arch/x86/memory.c +++ b/xen/arch/x86/memory.c @@ -1757,17 +1757,20 @@ int ptwr_do_page_fault(unsigned long addr) which = PTWR_PT_INACTIVE; if ( (l2e >> PAGE_SHIFT) == pfn ) { - /* - * If the PRESENT bit is clear, we may be conflicting with the current - * ACTIVE p.t. (it may be the same p.t. mapped at another virt addr). - */ - if ( unlikely(!(l2e & _PAGE_PRESENT)) && - ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va ) - ptwr_flush(PTWR_PT_ACTIVE); - - /* Now do a final check of the PRESENT bit to set ACTIVE. */ + /* Check the PRESENT bit to set ACTIVE. */ if ( likely(l2e & _PAGE_PRESENT) ) which = PTWR_PT_ACTIVE; + else { + /* + * If the PRESENT bit is clear, we may be conflicting with + * the current ACTIVE p.t. (it may be the same p.t. mapped + * at another virt addr). + * The ptwr_flush call below will restore the PRESENT bit. + */ + if ( ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va && + l2_idx == ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l2_idx ) + which = PTWR_PT_ACTIVE; + } } PTWR_PRINTK("[%c] page_fault on l1 pt at va %08lx, pt for %08x, " -- 2.30.2